<%@ include file="/Pages/Jsp/Common/header.jsp"%>

<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/Pages/Js/groupJS.js"></script>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<script type="text/javascript">
<!--
	var sortOrder = "asce";
	$(document).ready(function(){
		bindGroupStatus();
	});
//-->
</script>
<div style="width:960px; margin-left:auto; margin-right:auto;">
 <form name="frmModifyGroup" method="post">
   <fieldset>
		<legend>
		  Maintain Group - Search
		</legend>

		<p>
			<label class="span-4"> Group Name:</label>
			<input id="groupNameQuery" name="groupNameQuery" Required="True" 
			class="span-4" type="text" maxlength="20" value="${groupNameQuery}">
		</p>
    	<p>
			<label class="span-4"> Active:</label>
			<select id="groupActiveQuery"  class="span-4" name="groupActiveQuery" >
				<option value="99">-- Please Select --</option>
				<option value="0"  title="Active">Yes</option>
				<option value="1" title="Inactive">No</option>
    		</select>
    		<input id="hiddenGroupNameQuery"  class="noDisplay" type="text" value="${groupActiveQuery}">
     	</p>
     	<p>
			<input type="button" value="Search" onClick="searchGroup()" />
			<input type="button" value="Reset"  onClick="resetGroupSearch()"/>
			<input value="Back" type="button" onclick="window.location.href='<%=request.getContextPath()%>/Pages/Jsp/User/userMenu.jsp'">
  	</p>
    </fieldset>
	<hr class="space"/>
 	<fieldset>
		<legend>
		   Search Results
		</legend>
		<table class="blueTable span-16">
			<tr>
			   <th><a onClick="sortGroup(this)" title="name" class="handLink">
					Group Name</a>
			   </th>
				<th><a onClick="sortGroup(this)" title="status" class="handLink">Active</a></th>
				<th><a onClick="sortGroup(this)" title="desc" class="handLink">Description</a></th>
			</tr>
			<logic:iterate id="groups" name="groupList"
				type="com.capgemini.fs.app.ekms.model.Group">
				<tr>	
					<td style="display: none">
						<input id="Id"  title="groupId" value="${groups.id}"/>
					</td>
					<td class="span-3"><input style="display:none"  id="GroupName" value="${groups.groupName}"/><span id="GroupName">
					<a onClick="alertModifyGroup(this)" class="handLink">
					${groups.groupName}</a>
					<!--<bean:write name="groups"
						property="groupName" /></span></td>-->
					<td class="span-1"><input style="display: none"  id="GroupStatus" value="${groups.status}"/><span id="GroupStatus">${groups.status==0?"Yes":"No" }</span>
					</td>
					<td class="span-5"><input style="display: none"  id="GroupDesc" value="${groups.description}"/><span id="GroupDesc" class="lineLength"><bean:write name="groups"
						property="description" /></span></td>
					<!--<td class="span-3">
						<a onClick="alertModifyGroup(this)" class="handLink" title="Modify">Modify</a>
					</td>
				--></tr>
			</logic:iterate>
		</table>
		<div id="pageLinks">
				<a href="#" onClick="goToFirstPage()">
					First Page
				</a> 
				&nbsp;&nbsp; 
				<a href="#" onClick="goToPreviousPage()"> 
					Previous Page
				</a> 
				&nbsp;&nbsp;
				<input readonly="readonly" class="span-2" id="currentPage" value="${totalPage}"/>
				&nbsp;&nbsp;
				<a href="#" onclick="goToNextPage()"> 
					Next Page
				</a> 
				&nbsp;&nbsp;
				<a href="#" onClick="goToLastPage()"> 
					Last Page
				</a> 
				&nbsp;&nbsp;
		<input class="span-1"  name="targetPage"  id = "pageNum"/>
		<input class="span-1 noDisplay"  name="nowPage"  value="${nowPage}"></input>
		<input class="span-1 noDisplay"  name="totalPage"  value="${totalPageNum}"></input>
		<input type="button" value="Go" onClick="goToPage()"/>
	</div>
   </fieldset>
	<input style="display:none" id="hiddenGroupID" name="groupId">
	<div id="popDiv" class="popupDiv span-15 noDisplay" >
		<div class="popTitle span-13">Maintain Group</div> 
		<div class="handLink span-1 closeX last" onClick="resetGroupDialog()">X</div>
		<hr></hr>
	  	<p id="errors" class="error  span-12 noDisplay" style="margin-left:18px;"/>
  	  	<p id="noticeTxt" class="notice noDisplay  span-8"  style="margin-left:15px;" />
  		<div id="loadmessage">
		    <p>
					<label class="span-4"><span class="errtxt">*</span>Group Name:</label>
		    		<input id="hiddenGroupName"  name="groupName" maxlength="20"></input>
		    </p>
		    <p>
		    		<label class="span-4"><span class="errtxt">*</span>Active:</label>
		    		<select id="hiddenGroupStatus"  onchange="groupStatusChange()" class="span-4" name="groupStatus">		
						<option value="0" title="Active">Yes</option>
						<option value="1" title="Inactive">No</option>
		    		</select>
		    		<input class="noDisplay" id="hiddenGroupStatus" name="groupStatus"></input>
		    </p>
		    <p id="activeUsers"  style="padding-left:105px;">
		    		<input  id="ckbActiveUsers" type="checkbox" ></input><span id="activeNotice"></span>
		    </p>
		    <p>
		    		<label class="span-4"> Description:</label>
		    		<textarea class="span-7"  id="hiddenGroupDesc" 
		    		name="hiddenGroupDesc" style="height:100px;" 
		    		onkeydown="check(this,100)"></textarea>
		    </p>
   			<input type="button" onClick="modifyGroup()" title="Submit" name="Submit" value="Save"></input>
     		<input value="Reset" type="button" onclick="resetMethod()">&nbsp;
     		<input value="Back" type="button" onclick="resetGroupDialog()">
     		<!--<img id="loadingPic" class="noDisplay" src="<%=request.getContextPath()%>/Pages/Images/smallloading.gif" >-->
 		</div>
 		<div id="autoCloseMsg" class="succTxt noDisplay">
 			Page will be closed automatically after 5 seconds.
 		</div>
	</div>
	<div id="loadingbg" class="bg noDisplay">
	</div>
	<input id="sortType" name="sortType"  class="noDisplay" value="${sortType}"></input>
	<input id="sortOrder" name="sortOrder" class="noDisplay"  value="${sortOrder}"></input>
	<div class="clear"></div>
</form>
</div>